home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / cpp-olib.zip / LIBS.ZIP / TUI.H < prev    next >
C/C++ Source or Header  |  1992-12-28  |  7KB  |  376 lines

  1. #include <dos.h>
  2. #include <string.h>
  3.  
  4. #define TRUE 1
  5. #define FALSE 0
  6.  
  7. #define ALTA 30
  8. #define ALTB 48
  9. #define ALTC 46
  10. #define ALTD 32
  11. #define ALTE 18
  12. #define ALTF 33
  13. #define ALTG 34
  14. #define ALTH 35
  15. #define ALTI 23
  16. #define ALTJ 36
  17. #define ALTK 37
  18. #define ALTL 38
  19. #define ALTM 50
  20. #define ALTN 49
  21. #define ALTO 24
  22. #define ALTP 25
  23. #define ALTQ 16
  24. #define ALTR 19
  25. #define ALTS 31
  26. #define ALTT 20
  27. #define ALTU 22
  28. #define ALTV 47
  29. #define ALTW 17
  30. #define ALTX 45
  31. #define ALTY 21
  32. #define ALTZ 44
  33.  
  34. #define ALT1 120
  35. #define ALT2 121
  36. #define ALT3 122
  37. #define ALT4 123
  38. #define ALT5 124
  39. #define ALT6 125
  40. #define ALT7 126
  41. #define ALT8 127
  42. #define ALT9 128
  43. #define ALT0 129
  44.  
  45. #define ALTMINUS  130
  46. #define ALTPLUS   131
  47.  
  48. //LIB
  49. void vprintat(int cols,int rows,int fore,int back,char *,...);
  50. void vprintc(int row,int fore,int back,char *,...);
  51. void printat(int,int,int,int,char *);
  52. void printc(int,int,int,char *);
  53. void cprintat(int,int,int,int,char *,...);
  54. void cprintc(int,int,int,char *,...);
  55. void clear(char ch,int fore,int back);
  56. void cursoroff();
  57. void cursoron();
  58. void settext(int,int);
  59. void chsattr(int,int);
  60. void chcattr(int,int,int,int,int);
  61. void dlay(int ticks);
  62. long getticks();
  63. int altkey();
  64. int ctrlkey();
  65. int lshiftkey();
  66. int rshiftkey();
  67. void flushkeys();
  68. unsigned char getvidmode();
  69.  
  70. //MOUSECLASS
  71. class Mcursor {
  72.       int shown;
  73.       int current;
  74.       int xpos;
  75.       int ypos;
  76.       void mouse_interrupt();
  77.       int m1;
  78.       int m2;
  79.       int m3;
  80.       int m4;
  81.       int button;
  82.       int count;
  83.       long tickcount;
  84.       int disabled;
  85.     public:
  86.       int  init();
  87.       void get_status();
  88.       void show();
  89.       void hide();
  90.       void set_hor_bounds(int,int);
  91.       void set_ver_bounds(int,int);
  92.       void Mcursor::conditional_off(int x1,int y1,int x2,int y2);
  93.       void Mcursor::position(int,int);
  94.       int  LBP();
  95.       int  RBP();
  96.       int  mousex();
  97.       int  mousey();
  98.       int  mx();
  99.       int  my();
  100.       void unarm();
  101.       void arm();
  102.       int  LBDCLK();
  103.       };
  104.  
  105. #define UPARROW 1
  106. #define DOT 2
  107. #define PENCIL 3
  108. #define CROSSHAIR 4
  109. #define ARROW 5
  110. #define FINGER 6
  111. #define POINT 7
  112. #define CLOCK 8
  113. #define DISK 9
  114. #define IBAR 10
  115. #define PAINTCAN 11
  116. #define HAND 12
  117. #define ERASOR 13
  118. #define GUNSIGHT 14
  119. #define SCISSORS 15
  120. #define JAWS 16
  121.  
  122. //WINDOW
  123. //typedef unsigned char screenbuff[4000];
  124. typedef char itemarray[24][80];
  125.  
  126. #define SINGLE 0
  127. #define DOUBLE 1
  128. #define HOR 0
  129. #define VER 1
  130.  
  131. class Twindow{
  132.     protected:
  133.         int x;
  134.         int y;
  135.         int x1;
  136.         int y1;
  137.         int fgd;
  138.         int bgd;
  139.         int shad;
  140.         int shadcolor;
  141.         int size;
  142.         char id[15];
  143.         int existtitle;
  144.         int bordertype;
  145.         int shown;
  146.         unsigned char *save;
  147.     public:
  148.         Twindow();
  149.         ~Twindow();
  150.         void getstyle();
  151.         void init(int xpos,int ypos,int x1pos,int y1pos,
  152.         int fore,int back,int shadow,int shadowcolor);
  153.         void border();
  154.         void setborder(int style);
  155.         int  getborder();
  156.         void cfgd(int fore);
  157.         void cbgd(int back);
  158.         int  getfgd();
  159.         int  getbgd();
  160.         void fill();
  161.         void divider(int direction,int style,int offset);
  162.         void show();
  163.         void zoom();
  164.         void hide();
  165.         void elim();
  166.         void title(char txt[15]);
  167.         int  istitle();
  168.         int isshown();
  169.         int isx();
  170.         int isy();
  171.         int isx1();
  172.         int isy1();
  173.         int issize();
  174.         void wprintat(int,int,int,int,char*);
  175.         void wprintc(int,int,int,char*);
  176.         };
  177.  
  178. class Tmenu:public Twindow{
  179.     protected:
  180.         int itemcount;
  181.         itemarray items;
  182.         int hifore;
  183.         int hiback;
  184.         int menuchoice;
  185.     public:
  186.         void init(int itemcnt,itemarray item,int xpos,int ypos,int width,
  187.         int fore,int back,int hfore,int hback,
  188.         int shadow,int shadowcolor);
  189.         int show();
  190.         void move(int xpos,int ypos);
  191.         };
  192.  
  193. //INPUT
  194. void beep();
  195. char *strdel(char *,int);
  196. char *strins(char *,int,char);
  197.  
  198. class Tstring {
  199.     protected:
  200.         char laststring[81];
  201.         char bar[81];
  202.         int xpos;
  203.         int x;
  204.         int y;
  205.         int length;
  206.         int ucase;
  207.         int escape;
  208.         int retrn;
  209.         int tab;
  210.         int uparrow;
  211.         int dnarrow;
  212.         int shown;
  213.         int barred;
  214.         int firstchar;
  215.         int infgd;
  216.         int inbgd;
  217.     public:
  218.         Tstring();
  219.         ~Tstring();
  220.         void init(int xloc,int yloc,int len,int uppercase);
  221.         void show();
  222.         void input();
  223.         void get_input();
  224.         void get_form_input();
  225.         void get_form_mouse_input();
  226.         void reset();
  227.         void preset(char *);
  228.         void erase(int);
  229.         char *getstring();
  230.         int escapehit();
  231.         int returnhit();
  232.         int tabhit();
  233.         int uparrowhit();
  234.         int dnarrowhit();
  235.         int isshown();
  236.         int isbarred();
  237.         int hit();
  238.         void setincolors(int,int);
  239.         };
  240.  
  241. class Tnumeral:public Tstring {
  242.     protected:
  243.         int real;
  244.         int end;
  245.     public:
  246.         void init(int xloc,int yloc,int len,int int_or_float);
  247.         void show();
  248.         void get_input();
  249.         void get_form_input();
  250.         void get_form_mouse_input();
  251.         void input();
  252.         float getfloat();
  253.         int getint();
  254.         long getlong();
  255.         };
  256.  
  257. class Tdate:public Tstring {
  258.     protected:
  259.         int date_ok;
  260.     public:
  261.         void init(int xloc,int yloc);
  262.         void show();
  263.         void get_input();
  264.         void validate();
  265.         int  verified();
  266.         char *getdatestring();
  267.         long getdate();
  268.         };
  269.  
  270. //TBUTTON
  271. class Tbutton {
  272.     protected:
  273.         int xpos;
  274.         int ypos;
  275.         int width;
  276.         int pressed;
  277.         int hilite;
  278.         char button[81];
  279.         char shadow[81];
  280.         char id[41];
  281.     public:
  282.         Tbutton();
  283.         void init(int,int,char *,int);
  284.         ~Tbutton();
  285.         void show(int);
  286.         int buttonpressed();
  287.         int hit();
  288.         void press(int);
  289.         int ispressed();
  290.         };
  291.  
  292. class Tcheckbox {
  293.     protected:
  294.         int xpos;
  295.         int ypos;
  296.         int fgd;
  297.         int bgd;
  298.         int checked;
  299.     public:
  300.         Tcheckbox();
  301.         void init(int,int,int,int);
  302.         ~Tcheckbox();
  303.         void show();
  304.         void grabcursor();
  305.         int hit();
  306.         void check();
  307.         void uncheck();
  308.         int ischecked();
  309.         };
  310.  
  311. //MISC
  312. void smover(int row,int startpos,int endpos,int fgd,int bgd,char *string);
  313. void smovel(int row,int startpos,int endpos,int fgd,int bgd,char *string);
  314. void smoveu(int col,int startpos,int endpos,int fgd,int bgd,char *string);
  315. void smoved(int col,int startpos,int endpos,int fgd,int bgd,char *string);
  316.  
  317. //SOUNDQ
  318. #define TimerTick 0x8
  319. #define noisemax 8192
  320. #define ON 1
  321. #define OFF 0
  322.  
  323. #define C 523
  324. #define CS 554
  325. #define D 587
  326. #define DS 622
  327. #define E 659
  328. #define F 698
  329. #define FS 740
  330. #define G 784
  331. #define GS 831
  332. #define A 880
  333. #define AS 932
  334. #define B 988
  335. #define C1 1046
  336.  
  337. #define SN 32
  338. #define EN 63
  339. #define QN 125
  340. #define HN 250
  341. #define WN 500
  342.  
  343. #define ENT 20
  344. #define QNT 41
  345. #define HNT 83
  346.  
  347. #define BN 30000,5
  348. #define SR 30000,32
  349. #define ER 30000,63
  350. #define QR 30000,125
  351. #define HR 30000,250
  352. #define WR 30000,500
  353. #define NM 30000,1
  354.  
  355. class SoundQ{
  356.     protected:
  357.         float speed_factor;
  358.     public:
  359.         SoundQ();
  360.         ~SoundQ();
  361.         void play(int,int);
  362.         void adjust_speed(float);
  363.         };
  364.  
  365. typedef struct
  366. {
  367.   int duration;
  368.   int freq;
  369. } noise;
  370.  
  371. void empty_sound_queue();
  372. void init_sound(void);
  373. void restore_sound(void);
  374. int submit_sound(int freq,int delay);
  375. void interrupt soundsystem(...);
  376.